import request from '@/utils/request'

const sysApi = {
  add: '/pc/sys/permission/add',
  update: '/pc/sys/permission/update',
  op: '/pc/sys/permission/op',
  listAll: '/pc/sys/permission/listAll',
  getTreeAll: '/pc/sys/permission/tree/all',
  listDir: '/pc/sys/permission/listDir'
}

export default sysApi

export function listDir () {
  return request({
    url: sysApi.listDir,
    method: 'get'
  })
}

export function sysPermissionOp (op, id) {
  return request({
    url: sysApi.op + '/' + op + '/' + id,
    method: 'post'
  })
}

export function sysPermissionAdd (parameter) {
  return request({
    url: sysApi.add,
    method: 'post',
    data: parameter
  })
}

export function sysPermissionUpdate (parameter) {
  return request({
    url: sysApi.update,
    method: 'post',
    data: parameter
  })
}

export function getTreeAll (parameter) {
  return request({
    url: sysApi.getTreeAll,
    method: 'get',
    params: parameter
  })
}

export function listAll (parameter) {
  return request({
    url: sysApi.listAll,
    method: 'get',
    params: parameter
  })
}

